var idService = require('../../services/idService'),
    mongoose = require('mongoose'),
    nodeunit = require('nodeunit');

var modelStrEg = 'test';

exports['categories'] = nodeunit.testCase({
    'initialize' : function (test) {
        test.doesNotThrow(
            function() {
                idService.initializeModelId(modelStrEg, function(resp) {});
            }
        );
        setTimeout(test.done, 500);
    },
    'getFirstId' : function (test) {
        test.doesNotThrow(
            function() {
                idService.getId(modelStrEg, function(id){
                    test.ok(id, 'Recuperé FirstId');
                    test.equal(id, 1, 'Id inicializado en 1');
                });
            }
        );
        setTimeout(test.done, 500);
    },
    'getNextId' : function (test) {
        test.doesNotThrow(
            function() {
                idService.getId(modelStrEg, function(id){
                    test.ok(id, 'Recuperé NextId');
                    test.equal(id, 2, 'Siguiente Id 2');
                });
            }
        );
        setTimeout(test.done, 500);
    },
    'done': function(test) {
        test.doesNotThrow(
            function() {
                idService.remove(modelStrEg, function(resp){
                    mongoose.disconnect();
                });
            }
        );
        setTimeout(test.done, 500);
    }
});
